//
//  ViewController.m
//  EmptyProjectNavigationController
//
//  Created by YannisChou on 16/3/15.
//  Copyright © 2016年 Alibaba. All rights reserved.
//
//  在QQ联系人视图右侧导航中添加一个导航到公共账号的按钮
//

#import "KCQQContactViewController.h"
#import "KCPublicAccountViewController.h"

@interface KCQQContactViewController ()

@end

@implementation KCQQContactViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    // 每次出栈都会销毁相应的子控制器
    NSLog(@"childViewControllers:%@",self.navigationController.childViewControllers);
    
    [self setTitle:@"QQ Contact"];
    
    UIBarButtonItem *back = [[UIBarButtonItem alloc]
                             initWithTitle:@"QQ" style:UIBarButtonItemStyleDone target:nil action:nil];
    self.navigationItem.backBarButtonItem = back;
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Public Account" style:UIBarButtonItemStyleDone target:self action:@selector(gotoNextView)];
}

-(void)gotoNextView{
    KCPublicAccountViewController *publicAccountController = [[KCPublicAccountViewController alloc] init];
    [self.navigationController pushViewController:publicAccountController animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
